package com.hyt.it.ogt.kq.service.govData.tps;

import com.hyt.common.apiInfor.ApiResponse;
import com.hyt.core.exception.NestedBusinessException;
import com.hyt.it.ogt.kq.service.gov.model.vo.obs.HuaweiObsCopyObjectResultVO;
import com.hyt.it.ogt.kq.service.gov.model.vo.obs.HuaweiObsObjectMetaDataVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.convert.Bucket;
import org.springframework.stereotype.Component;

/**
 * 第三方微服务（tps）Feign客户端熔断器
 */
@Slf4j
@Component
public class GovDataTpsClientHystrix implements GovDataTpsClient {

    @Override
    public ApiResponse<String> compressTencentCosPhoto(String officeId, String key, String targetPath) throws NestedBusinessException {
        log.error("#压缩腾讯云COS图片文件，并存储至指定路径失败，进入熔断");
        throw new NestedBusinessException("压缩腾讯云COS图片文件，并存储至指定路径失败");
    }

    @Override
    public ApiResponse<String> uploadTencentCosCompressedPhoto(String officeId, String path, byte[] bytes) throws NestedBusinessException {
        log.error("#上传压缩腾讯云COS图片文件失败，进入熔断");
        throw new NestedBusinessException("上传压缩腾讯云COS图片文件失败");
    }

    @Override
    public ApiResponse<byte[]> downloadTencentCosFile(String officeId, String path) throws NestedBusinessException {
        log.error("#下载腾讯云COS文件失败，进入熔断");
        throw new NestedBusinessException("下载腾讯云COS文件失败");
    }

    @Override
    public ApiResponse<byte[]> downloadHuaweiObsFile(String officeId, String path) throws NestedBusinessException {
        log.error("#下载华为云OBS文件失败，进入熔断");
        throw new NestedBusinessException("下载华为云OBS文件失败");
    }

    @Override
    public ApiResponse<Bucket> getTencentCosTempCredential(String officeId) throws NestedBusinessException {
        log.error("#获取腾讯云COS临时凭证失败，进入熔断");
        throw new NestedBusinessException("获取腾讯云COS临时凭证失败");
    }

    @Override
    public ApiResponse<HuaweiObsCopyObjectResultVO> copyHuaweiObsObject(String officeId, String sourceObject, String destObject) {
        log.error("#复制华为云OBS对象失败，进入熔断");
        throw new NestedBusinessException("复制华为云OBS对象失败");
    }

    @Override
    public String getStringFromHuaweiObs(String path, String charset) {
        log.error("#从华为云存储获取html文件失败，进入熔断");
        throw new NestedBusinessException("从华为云存储获取html文件失败");
    }

    @Override
    public String uploadFileToHuawei(String officeId, String path, byte[] bytes) {
        log.error("#上传华为云存储失败，进入熔断");
        throw new NestedBusinessException("上传华为云存储失败");
    }

    @Override
    public Object getBmQRCode(String officeId, String scene, String page, Integer width)  {
        log.error("#获取报名小程序失败，进入熔断");
        return null;
    }

    @Override
    public ApiResponse<HuaweiObsObjectMetaDataVO> getHuaweiObsObjectMetaData(String officeId, String objectKey) {
        log.error("# 获取华为云OBS对象属性失败，进入熔断");
        return null;
    }

}
